﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PhysioAssist2
{
    public partial class TabletAgenda : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) CarregaAgenda(DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year, 10);//HARDCODE
            //if (!IsPostBack) CarregaAgenda(15, DateTime.Now.Month, DateTime.Now.Year, 1);
        }

        private void CarregaAgenda(int dia, int mes, int ano, int profissional)
        {

            Label lbl = new Label();

            lbl.Text = "Compromissos do dia " + dia + "/" + mes + "/" + ano + "<br />" + "<br />";
            lbl.CssClass = "texto";
            divAgenda.Controls.Add(lbl);

            WS ws = new WS();
            List<Agenda> lst = ws.ListaAgenda(dia, mes, ano, profissional);


            if (lst.Count == 0)
            {
                lbl = new Label();
                lbl.Text = "    Nenhum compromisso cadastrado";
                lbl.CssClass = "subtexto";
                divAgenda.Controls.Add(lbl);
            }


            foreach (Agenda age in lst)
            {

                Image img = new Image();
                img.CssClass = "icoAgenda";
                img.ImageUrl = "Imagens/ico_agenda.png";
                divAgenda.Controls.Add(img);

                lbl = new Label();
                lbl.Text = age.hora + " - "; //+ "<br />";
                lbl.CssClass = "subtexto";
                divAgenda.Controls.Add(lbl);

                lbl = new Label();
                lbl.Text = age.compromisso + "<br />" + "<br />";
                lbl.CssClass = "texto";
                divAgenda.Controls.Add(lbl);

            }

        }

        protected void btnNovo_Click(object sender, EventArgs e)
        {
            Response.Redirect("TabletAgendaRegistro.aspx");
        }
    }
}